namespace CSharpDay12__Many_to_Many_.Migrations
{
    using CSharpDay12__Many_to_Many_.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<CSharpDay12__Many_to_Many_.Models.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(CSharpDay12__Many_to_Many_.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            context.Ships.AddOrUpdate(
                s => s.Id,
                new Ship { Id = 1, BaseWeight = 5000, GrossTonnage = 6500.25, CanalSize = CanalSize.ChinaMax, Name = "SS Chuck", IsAtSea = true },
                new Ship { Id = 2, BaseWeight = 10000, GrossTonnage = 15000, CanalSize = CanalSize.Panamax, Name = "SS Ricky", IsAtSea = true },
                new Ship { Id = 3, BaseWeight = 15000, GrossTonnage = 35000, CanalSize = CanalSize.PostPanamax, Name = "SS DangerZone", IsAtSea = false },
                new Ship { Id = 4, BaseWeight = 2000, GrossTonnage = 6000, CanalSize = CanalSize.Suezmax, Name = "SS Rick Astley", IsAtSea = false },
                new Ship { Id = 5, BaseWeight = 2500, GrossTonnage = 6500.50, CanalSize = CanalSize.ChinaMax, Name = "SS Super Mario", IsAtSea = true }


                );
            context.Cargoes.AddOrUpdate(
                c => c.Id,
                new Cargoe {Id = 1, Name ="Not Nuclear Waste we swear", IsPerishable = true, CargoeType = CargoeType.WMD, Weight = 2000},
                new Cargoe {Id = 2, Name ="Food Stuff", IsPerishable = true, CargoeType = CargoeType.Agriculture, Weight = 1000},
                new Cargoe {Id = 3, Name ="Really Not Nuclear Waste we hope", IsPerishable = false, CargoeType = CargoeType.Energy, Weight = 5000},
                new Cargoe {Id = 4, Name ="Clothing", IsPerishable = false, CargoeType = CargoeType.ConsumerGoods, Weight = 550.67},
                new Cargoe {Id = 5, Name ="Whatever Rich People eat", IsPerishable = true, CargoeType = CargoeType.WMD, Weight = 12000}

                
                );

            context.Ships_Cargoes.AddOrUpdate(
                p => p.Id,
                new Ship_Cargoe { Id = 1, CargoeId = 2, ShipId = 1, Containers = 1 },
                new Ship_Cargoe { Id = 2, CargoeId = 2, ShipId = 2, Containers = 3 },
                new Ship_Cargoe { Id = 3, CargoeId = 4, ShipId = 2, Containers = 1 },
                new Ship_Cargoe { Id = 4, CargoeId = 5, ShipId = 3, Containers = 1 },
                new Ship_Cargoe { Id = 5, CargoeId = 3, ShipId = 3, Containers = 1 },
                new Ship_Cargoe { Id = 6, CargoeId = 1, ShipId = 3, Containers = 1 },
                new Ship_Cargoe { Id = 7, CargoeId = 1, ShipId = 4, Containers = 2 },
                new Ship_Cargoe { Id = 8, CargoeId = 1, ShipId = 5, Containers = 1 }
                


                );
        }
    }
}
